package com.happyfamily.springboot.crowdsourcingplatform.dao.guo;

import com.happyfamily.springboot.crowdsourcingplatform.model.*;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ServiceDao
{


	/**
	 *根据用户id 投标类型，以及截止日志不为空，查询获取投标集合
	 * @param userid 用户id
	 * @param ttype 投标类型
	 * @return
	 */
	@Select("SELECT *FROM tender where userid=#{userid} AND ttype=#{ttype} AND tendtime is not null")
	List<Tender> getOneTender(@Param("userid") Long userid,@Param("ttype") String ttype);

	/**
	 * 根据用户账号查询用户对象
	 * @param uaccount 用户账号
	 * @return
	 */
	@Select("select * from sys_user where uaccount=#{uaccount}")
	SysUser getUser(String uaccount);

	/**
	 * 根据需求id查订单对象
	 * @param needid 需求id
	 * @return
	 */
	@Select("SELECT * FROM orders WHERE needid=#{needid}")
    Orders getOrder(Long needid);

	/**
	 * 联user表和联盟表，查询这个用户得所有联盟集合
	 * @param uid  user对象id
	 * @return
	 */
	@Select("SELECT a.*from sys_user s,alliance a where s.uid=a.amasterid and s.uid=#{uid}")
	List<Alliance> getAllianceList2(Long uid);

	/**
	 * 根据订单id查询所有订单操作
	 * @param orderid 订单id
	 * @return
	 */
    @Select("SELECT *FROM order_form where orderid=#{orderid} order by orderformid")
	List<OrderForm> getOrderForm(Long orderid);

}
